package org.four.merchant.controller;


import org.four.common.model.CompanyTree;
import org.four.common.model.LayuiPage;
import org.four.common.model.ZhaoPinBean;
import org.four.merchant.service.ZslService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("zsl")
@RestController
public class ZslController {

    @Autowired
    private ZslService zslService;

    @RequestMapping("findNavTree")
    public List<CompanyTree> findNavTree(){
        return zslService.findNavTree();
    }


    /**
     * 新增招聘
     * @param zhaoPinBean
     * @return
     */
    @RequestMapping("addZhaoPin")
    public ZhaoPinBean addZhaoPin(@RequestBody ZhaoPinBean zhaoPinBean){
        ZhaoPinBean ZhaoPinBeans = zslService.addZhaoPin(zhaoPinBean);

        return ZhaoPinBeans;
    }

    /**
     * 查询招聘信息
     * @param limit
     * @param page
     * @param zhaoPinBean
     * @return
     */
    @RequestMapping("queryZhaoPin")
    public LayuiPage queryZhaoPin(int limit, int page,@RequestBody ZhaoPinBean zhaoPinBean){
        return zslService.queryZhaoPin(limit,page,zhaoPinBean);
    }

    /**
     * 删除招聘信息
     * @param id
     */
    @RequestMapping("delZhaoPin")
    public void  delZhaoPin(Integer[] id){
        zslService.delZhaoPin(id);
    }

    /**
     * 查询投递信息
     * @param limit
     * @param page
     * @return
     */
    @RequestMapping("queryTouDi")
    public LayuiPage queryTouDi(int limit, int page,Integer id){
        return zslService.queryTouDi(limit,page,id);
    }

    /**
     * 是否同意本公司初试
     * @param id
     * @param status
     */
    @RequestMapping("updatestatus")
    public void updatestatus(Integer id,Integer status){
        zslService.updatestatus(id,status);
    }


    @RequestMapping("dingdan")
    public void dingdan(Integer id){
        zslService.dingdan(id);
    }

    /**
     * 公司发布的岗位 数据
     * @return
     */
    @RequestMapping("findComZhaoPin")
    public List findComZhaoPin(Integer id){
        System.out.println("公司发布的岗位 数据");
        List list = zslService.findComZhaoPin(id);
        return list;
    }

    /**
     * 购买套餐
     * @param id
     * @param count
     */
    @RequestMapping("addComUserCount")
    public void addComUserCount(Integer id,Integer count){
        zslService.addComUserCount(id,count);
    }

    @RequestMapping("findCount")
    public Integer findCount(Integer id){
        return zslService.findCount(id);
    }

    @RequestMapping("queryById")
    public ZhaoPinBean queryById(Integer id){
        return zslService.queryById(id);
    }

    @RequestMapping("updateTime")
    public void updateTime(Integer id){
        zslService.updateTime(id);
    }
}
